class Solution {
public:
    void deleteNode(ListNode* node) {
        if (node == nullptr)
            return;
        ListNode* cur = node;
        ListNode* nextnode = node->next;
        while (nextnode->next != nullptr)
        {
            cur->val = nextnode->val;
            cur = nextnode;
            nextnode = nextnode->next;
        }
        cur->val = nextnode->val;
        cur->next = nullptr;
    }
};